package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.aliyuncs.exceptions.ClientException;
import com.itheima.constant.MessageConstant;
import com.itheima.constant.RedisMessageConstant;
import com.itheima.entity.Result;
import com.itheima.pojo.Address;
import com.itheima.pojo.Order;
import com.itheima.service.AddressService;
import com.itheima.service.OrderService;
import com.itheima.utils.SMSUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import redis.clients.jedis.JedisPool;

import java.util.List;
import java.util.Map;

/**
 * 体检地址
 */
@RestController
@RequestMapping("/address")
public class AddressController {

    @Reference
    private AddressService addressService;

    //查询所有地址
    @RequestMapping("/findAll")
    public Result findAll(){
        try {
            List<Address> addressList = addressService.findAll();
            return new Result(true,MessageConstant.GET_ADDRESS_SUCCESS,addressList);
        }catch (Exception e){
            e.printStackTrace();
            return new Result(false,MessageConstant.GET_ADDRESS_SUCCESS);
        }
    }
}
